Computational social science R code

R code and materials from my doctoral seminar on computational social science at Rutgers University.
Published

November 10, 2026

This page collects R code and materials from my Computational Social Science course at Rutgers University. The course combines theoretical discussion with hands-on training in R. It is a doctoral seminar that offers a gentle introduction to computational methods, both for people with some coding experience and for those just starting to learn. Topics include an introduction to R, survey data analysis, APIs, web scraping, network analysis, data visualization, text analysis, large language models, machine learning, and research ethics.

R code for the 2026 lectures

Data

The scripts download most of what they need. You can also get the data files here:

The LLM scripts need your own API keys for OpenAI, Gemini, or the Guardian; the code shows where to set them.

The 2023 version

The 2023 version of the course had separate weeks on network groups and communities (QAP, permutation tests) and did not cover large language models. Its materials are still available.